package com.kintreda.ieco_server.module.api.web;

import com.kintreda.ieco_server.bean.place.Place;
import com.kintreda.ieco_server.core.repository.IBaseRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * @Created by IntelliJ IDEA
 * @Project_Name ieco_server
 * @Package com.kintreda.ieco_server.module.Place.web
 * @Author ZhongYao_H
 * @Date 2019/5/8:9:32
 * @Year 2019 Month 05 Day 08
 * @Date_zh 2019 年 五月 星期三
 */

@Controller
@RequestMapping("/api/place")
public class ApiPlaceController {


    @Autowired
    private IBaseRepository<Place,String> placeStringIBaseRepository;


    @RequestMapping(value = "/query",method = RequestMethod.POST)
    @ResponseBody
    public  Object query(Integer type){
        StringBuffer sql  = new StringBuffer("select id as idp,name,longitude, latitude,address , type ,orgId as id from place where type = ? ");
        List<Map<String, Object>> listBySql = placeStringIBaseRepository.findListBySql(sql.toString(), new Object[]{type});
        return listBySql;
    }



}
